class ListNode:
    def __init__(self,val=0,next=None):
        self.val = val
        self.next = next

def printLink(node1):
    print("it is printLink",end=":")
    #if(node1.val == 0):return []
    res = []
    node = node1
    while node:
        print(node.val,end=" ")
        res.append(node.val)
        node = node.next
    print(res)
    return res

def printCycLink(node):
    head = node
    while True:
        print(node.val,end = " ")
        node = node.next
        if node == head:break
